package edu.unf.cen6940.service;

import edu.unf.cen6940.domain.Faculty;
import edu.unf.cen6940.domain.Facultyresearch;
import edu.unf.cen6940.domain.Facultyresearchtostudent;
import edu.unf.cen6940.domain.Thesiscommittee;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/rms_test-security-context.xml",
		"file:./resources/rms_test-service-context.xml",
		"file:./resources/rms_test-dao-context.xml",
		"file:./resources/rms_test-web-context.xml" })
@Transactional
public class FacultyServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected FacultyService service;

	/**
	 * Instantiates a new FacultyServiceTest.
	 *
	 */
	public FacultyServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Return all Faculty entity
	 * 
	 */
	@Test
	public void findAllFacultys() {
		// TODO: JUnit - Populate test inputs for operation: findAllFacultys 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Faculty> response = null;
		response = service.findAllFacultys(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllFacultys
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Facultyresearch entity
	 * 
	 */
	@Test
	public void deleteFacultyFacultyresearchs() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyFacultyresearchs 
		Integer faculty_facultyId = 0;
		Integer related_facultyresearchs_facultyResearchId = 0;
		Faculty response = null;
		response = service.deleteFacultyFacultyresearchs(faculty_facultyId, related_facultyresearchs_facultyResearchId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyFacultyresearchs
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void deleteFacultyFacultyresearchtostudents() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyFacultyresearchtostudents 
		Integer faculty_facultyId_1 = 0;
		Integer related_facultyresearchtostudents_facultyResearchId = 0;
		Integer related_facultyresearchtostudents_studentId = 0;
		Integer related_facultyresearchtostudents_facultyId = 0;
		Faculty response = null;
		response = service.deleteFacultyFacultyresearchtostudents(faculty_facultyId_1, related_facultyresearchtostudents_facultyResearchId, related_facultyresearchtostudents_studentId, related_facultyresearchtostudents_facultyId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyFacultyresearchtostudents
	}

	/**
	 * Operation Unit Test
	 * Save an existing Faculty entity
	 * 
	 */
	@Test
	public void saveFaculty() {
		// TODO: JUnit - Populate test inputs for operation: saveFaculty 
		Faculty faculty = new edu.unf.cen6940.domain.Faculty();
		service.saveFaculty(faculty);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForCommitteeMember4() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForCommitteeMember4 
		Integer faculty_facultyId_2 = 0;
		Integer related_thesiscommitteesforcommitteemember4_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForCommitteeMember4(faculty_facultyId_2, related_thesiscommitteesforcommitteemember4_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForCommitteeMember4
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForCommitteeMember5() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForCommitteeMember5 
		Integer faculty_facultyId_3 = 0;
		Integer related_thesiscommitteesforcommitteemember5_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForCommitteeMember5(faculty_facultyId_3, related_thesiscommitteesforcommitteemember5_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForCommitteeMember5
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForCommitteeMember1() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForCommitteeMember1 
		Integer faculty_facultyId_4 = 0;
		Integer related_thesiscommitteesforcommitteemember1_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForCommitteeMember1(faculty_facultyId_4, related_thesiscommitteesforcommitteemember1_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForCommitteeMember1
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Faculty entity
	 * 
	 */
	@Test
	public void deleteFaculty() {
		// TODO: JUnit - Populate test inputs for operation: deleteFaculty 
		Faculty faculty_1 = new edu.unf.cen6940.domain.Faculty();
		service.deleteFaculty(faculty_1);
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForCommitteeMember5() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForCommitteeMember5 
		Integer facultyId = 0;
		Thesiscommittee related_thesiscommitteesforcommitteemember5 = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForCommitteeMember5(facultyId, related_thesiscommitteesforcommitteemember5);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForCommitteeMember5
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForChair() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForChair 
		Integer faculty_facultyId_5 = 0;
		Integer related_thesiscommitteesforchair_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForChair(faculty_facultyId_5, related_thesiscommitteesforchair_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForChair
	}

	/**
	 * Operation Unit Test
	 * Return a count of all Faculty entity
	 * 
	 */
	@Test
	public void countFacultys() {
		Integer response = null;
		response = service.countFacultys();
		// TODO: JUnit - Add assertions to test outputs of operation: countFacultys
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findFacultyByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findFacultyByPrimaryKey 
		Integer facultyId_1 = 0;
		Faculty response = null;
		response = service.findFacultyByPrimaryKey(facultyId_1);
		// TODO: JUnit - Add assertions to test outputs of operation: findFacultyByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Save an existing Facultyresearchtostudent entity
	 * 
	 */
	@Test
	public void saveFacultyFacultyresearchtostudents() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyFacultyresearchtostudents 
		Integer facultyId_2 = 0;
		Facultyresearchtostudent related_facultyresearchtostudents = new edu.unf.cen6940.domain.Facultyresearchtostudent();
		Faculty response = null;
		response = service.saveFacultyFacultyresearchtostudents(facultyId_2, related_facultyresearchtostudents);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyFacultyresearchtostudents
	}

	/**
	 * Operation Unit Test
	 * Save an existing Facultyresearch entity
	 * 
	 */
	@Test
	public void saveFacultyFacultyresearchs() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyFacultyresearchs 
		Integer facultyId_3 = 0;
		Facultyresearch related_facultyresearchs = new edu.unf.cen6940.domain.Facultyresearch();
		Faculty response = null;
		response = service.saveFacultyFacultyresearchs(facultyId_3, related_facultyresearchs);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyFacultyresearchs
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForCommitteeMember3() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForCommitteeMember3 
		Integer facultyId_4 = 0;
		Thesiscommittee related_thesiscommitteesforcommitteemember3 = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForCommitteeMember3(facultyId_4, related_thesiscommitteesforcommitteemember3);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForCommitteeMember3
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForCommitteeMember1() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForCommitteeMember1 
		Integer facultyId_5 = 0;
		Thesiscommittee related_thesiscommitteesforcommitteemember1 = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForCommitteeMember1(facultyId_5, related_thesiscommitteesforcommitteemember1);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForCommitteeMember1
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForCommitteeMember2() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForCommitteeMember2 
		Integer faculty_facultyId_6 = 0;
		Integer related_thesiscommitteesforcommitteemember2_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForCommitteeMember2(faculty_facultyId_6, related_thesiscommitteesforcommitteemember2_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForCommitteeMember2
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForCommitteeMember2() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForCommitteeMember2 
		Integer facultyId_6 = 0;
		Thesiscommittee related_thesiscommitteesforcommitteemember2 = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForCommitteeMember2(facultyId_6, related_thesiscommitteesforcommitteemember2);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForCommitteeMember2
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void deleteFacultyThesiscommitteesForCommitteeMember3() {
		// TODO: JUnit - Populate test inputs for operation: deleteFacultyThesiscommitteesForCommitteeMember3 
		Integer faculty_facultyId_7 = 0;
		Integer related_thesiscommitteesforcommitteemember3_thesisCommitteeId = 0;
		Faculty response = null;
		response = service.deleteFacultyThesiscommitteesForCommitteeMember3(faculty_facultyId_7, related_thesiscommitteesforcommitteemember3_thesisCommitteeId);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteFacultyThesiscommitteesForCommitteeMember3
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForChair() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForChair 
		Integer facultyId_7 = 0;
		Thesiscommittee related_thesiscommitteesforchair = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForChair(facultyId_7, related_thesiscommitteesforchair);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForChair
	}

	/**
	 * Operation Unit Test
	 * Load an existing Faculty entity
	 * 
	 */
	@Test
	public void loadFacultys() {
		Set<Faculty> response = null;
		response = service.loadFacultys();
		// TODO: JUnit - Add assertions to test outputs of operation: loadFacultys
	}

	/**
	 * Operation Unit Test
	 * Save an existing Thesiscommittee entity
	 * 
	 */
	@Test
	public void saveFacultyThesiscommitteesForCommitteeMember4() {
		// TODO: JUnit - Populate test inputs for operation: saveFacultyThesiscommitteesForCommitteeMember4 
		Integer facultyId_8 = 0;
		Thesiscommittee related_thesiscommitteesforcommitteemember4 = new edu.unf.cen6940.domain.Thesiscommittee();
		Faculty response = null;
		response = service.saveFacultyThesiscommitteesForCommitteeMember4(facultyId_8, related_thesiscommitteesforcommitteemember4);
		// TODO: JUnit - Add assertions to test outputs of operation: saveFacultyThesiscommitteesForCommitteeMember4
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
